home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1999 June / Macworld (1999-06).dmg / Serious Software / pdfToolbox 1.1 / -->> Acrobat Folder / pdfBatchMeister (fat) / pdfBatchMeister (fat).rsrc / RUNF_21005_runfile part 6 < prev    next >
Encoding:
Text File  |  1999-02-24  |  3.8 KB  |  137 lines

  1. % +++ BEGIN of runfile PART 6 +++
  2.  
  3. %%ThisPieceOfCodeName: (Generate PageSize for EPS files)  
  4.  
  5. %--------------------------------------------------------
  6. % Olaf Druemmer 02SEP97
  7. % Modified        06SEP97 od
  8. % Modified        10SEP98 od : restore/undefined error -> /CALS_save save def 
  9. % (C) 1997 callas software gmbh - Berlin - Germany
  10. % Portions Copyrighted by Adobe, Inc.
  11. %--------------------------------------------------------
  12. % Detect if PostScript file is an EPS, extract BoundingBox
  13. % and derive PageSize from BoundingBox as well as
  14. % adapt offset with respective translate call
  15. % To be used as RunFile replacement 
  16. %--------------------------------------------------------
  17. % IMPORTANT:
  18. % - Vor bisherigem RunFile Aufruf einfuegen
  19. % - statt RunFile --> PS_And_EPS_RunFile aufrufen
  20. % Aufruf-Konvention von PS_And_EPS_RunFile entspricht RunFile
  21. %--------------------------------------------------------
  22.  
  23.  
  24. %currentfile /ASCII85Decode filter cvx exec 
  25. /CALS_Margin 1 def % bbox margin (units 1/72 inch)
  26.  
  27. /CALS_PS_And_EPS_RunFile
  28. {
  29.   /CALS_FileName exch def
  30.   /CALS_save save def
  31.   CALS_FileName (r) file /CALS_F exch def
  32.   /CALS_S 32 string def CALS_F CALS_S readstring 
  33.   { pop } if
  34.   CALS_S 0 get 197 eq /CALS_EPSPrev? exch def 
  35.   CALS_EPSPrev?
  36.   { 
  37.     % (Processing EPS page ) print CALS_FileName print (\n) print
  38.     CALS_S 7 get 256 mul CALS_S 6 get add 256 mul CALS_S 5 get add 256 mul CALS_S 4 get add
  39.     /CALS_StartByte exch def
  40.     CALS_S 11 get 256 mul CALS_S 10 get add 256 mul CALS_S 9 get add 256  mul CALS_S 8 get add
  41.     /CALS_Length exch def
  42.  
  43.     /CALS_FX { CALS_F CALS_StartByte setfileposition
  44.      CALS_F CALS_Length () /SubFileDecode filter /CALS_FF exch def } def 
  45.   }
  46.   {
  47.     % (Processing PostScript file ) print CALS_FileName print (\n) print
  48.     /CALS_FX { /CALS_FF CALS_F def
  49.     CALS_F 0 setfileposition } def
  50.   }
  51.   ifelse
  52.  
  53.   CALS_FX
  54.   /CALS_S 255 string def
  55.   CALS_FF CALS_S readline pop /CALS_SS exch def
  56.   CALS_SS (%!PS-Adobe) anchorsearch 
  57.   {
  58.     pop pop
  59.     CALS_SS ( EPSF-) search
  60.     { pop pop pop true } 
  61.     { pop false } ifelse 
  62.   }
  63.   { pop false } ifelse
  64.   /CALS_EPSHead? exch def
  65.   CALS_EPSHead?
  66.   {
  67.     { CALS_FF CALS_S readline pop /CALS_SS exch def
  68.       CALS_SS (%%) anchorsearch
  69.       { pop pop
  70.         CALS_SS (%%BoundingBox:) anchorsearch
  71.         { pop pop
  72.           mark
  73.           CALS_SS 14 CALS_SS length 14 sub getinterval
  74.           cvx exec
  75.           counttomark 4 ne
  76.           {
  77.             (\(Msg 903: Unsupported coding for EPS bounding box\)) = flush
  78.             CALS_SS = flush exit
  79.           } 
  80.           {
  81.             /CALS_URY exch def /CALS_URX exch def
  82.             /CALS_BRY exch def /CALS_BRX exch def pop
  83.             << /PageSize [ CALS_URX CALS_BRX sub CALS_Margin dup add add   dup 72 lt { pop 72} if
  84.                CALS_URY CALS_BRY sub CALS_Margin dup add add dup 72 lt {  pop 72} if ] >> setpagedevice
  85.             CALS_BRX CALS_Margin sub neg CALS_BRY CALS_Margin sub neg  translate
  86.             % (EPS page size set\n) print flush
  87.           }
  88.           ifelse
  89.         }
  90.         { pop } ifelse
  91.       }
  92.       { pop exit } 
  93.       ifelse
  94.     } loop
  95.   }
  96.   { 
  97.       % (No EPS header\n) print 
  98.   } 
  99.   ifelse
  100.  
  101.   CALS_FX
  102.   globaldict /CALS_DidWeShowPage? false put
  103.   /CALS_TheRealShowPage /showpage load def
  104.   /showpage { /CALS_DidWeShowPage? true store CALS_TheRealShowPage } def
  105.  
  106.   /CALS_save2 save def mark
  107.   CALS_FF cvx exec
  108.   cleartomark 
  109.   CALS_save2 restore 
  110.  
  111.   CALS_DidWeShowPage? not
  112.   { CALS_TheRealShowPage } if
  113.  
  114.  CALS_save restore
  115. }
  116. bind def
  117.  
  118. % Note the double backslashes in the line below
  119. % (4 GB HD TESTEN:TEST-DATEI.EPS) PS_And_EPS_RunFile
  120. % showpage
  121. CALS_PS_And_EPS_RunFile
  122.  
  123.  
  124.  
  125. % ???? RunFile
  126.     (\(Msg 010: PDF file created\)) =
  127. }
  128. {
  129.     % this will not work...
  130.     (%%[ Error: prologue/epilogue.ps  missing or not PDF 1.2 ]%%) =
  131.     errordict /newerror true store
  132. }
  133. ifelse
  134. % (5)     alles fertig!
  135. %%EOF
  136. % +++ END of runfile PART 6 +++
  137.